<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
	<title>电梯地理位置</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel="stylesheet" type="text/css" href="../../css/style.css">
	<script type="text/javascript" src="../../js/jquery-1.8.2.js"></script>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>
	<script type="text/javascript" src="../../js/map/TextIconOverlay_min.js"></script>
	<script type="text/javascript" src="../../js/map/MarkerClusterer_min.js"></script>
	<script type="text/javascript">
	$(function(){
		try {
			var geolocation = new BMap.Geolocation();
			var map = new BMap.Map('container');
			map.enableScrollWheelZoom();
			map.enableContinuousZoom();
			map.addControl(new BMap.ScaleControl({anchor: BMAP_ANCHOR_BOTTOM_RIGHT}));	//比例尺
			map.addControl(new BMap.MapTypeControl({mapTypes: [BMAP_NORMAL_MAP,BMAP_HYBRID_MAP]}));	//地图类型
			map.addControl(new BMap.NavigationControl());  //添加默认缩放平移控件
			map.addControl(new BMap.NavigationControl({anchor: BMAP_ANCHOR_BOTTOM_LEFT, type: BMAP_NAVIGATION_CONTROL_PAN}));  //左下角，仅包含平移按钮
	
			var point = new BMap.Point(121.62626598061,38.920427897482);	//大连市坐标
			var markers = new Array();	//标注组
	
			geolocation.getCurrentPosition(function(r){
				if(this.getStatus() == BMAP_STATUS_SUCCESS){
					point = r.point;
					map.panTo(point);
				}
				map.centerAndZoom(point, 12);
				$.post('dtdlwz_load.action',{lng:point.lng,lat:point.lat},function(data){
					$.each(data,function(i,n){
						
						var opts = {  
							width: 250,     // 信息窗口宽度  
							height: 200,     // 信息窗口高度  
							title: '<span style="font-size:15px;color:#0A8021">电梯号：'+n.eleCode+'（概要）</span>'   // 信息窗口标题  
						}
						var content = 
							'<p><label>电梯名称：</label><span>'+n.eleName+'</span></p>'+
							'<p><label>经纬度：</label><span>'+n.eleLongitude+','+n.eleLatitude+'</span></p>';
						var info_Window = new BMap.InfoWindow(content, opts);
						var marker = new BMap.Marker();
						marker.setPosition(new BMap.Point(n.eleLongitude,n.eleLatitude));
						marker.addEventListener("click", function(e){
							this.openInfoWindow(info_Window);
						})
						markers.push(marker);
					});
					var markerClusterer = new BMapLib.MarkerClusterer(map,{markers:markers});
				},'json');
			});
		} catch (e) {
			alert('没有连接互联网');
		}
	});
	</script>
	<style type="text/css">
		.anchorBL{display:none;}
		.BMap_bubble_content p{clear:both;}
		.BMap_bubble_content p label{display:block;float:left;width:70px;text-align:left;}
		.BMap_bubble_content p span{display:block;float:left;}
	</style>
</head>
<body class="app">
	<h3>电梯地理位置</h3>
	<div id="container" style="width:100%;height:503px"></div>
</body>
</html>
